package com.kk.transactional.controller;

import com.kk.transactional.service.impl.UserServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.sql.SQLException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * .
 *
 * @author o_o
 * @date 2025-06-22
 */
@Api("用户模块")
@RestController
public class UserController {

    @Autowired
    UserServiceImpl userService;


    @ApiOperation("mybatis批量插入")
    @PostMapping("/test_mybatis")
    public void testM (int count) {
        userService.testBatchInsertUser(count);
    }

    @ApiOperation("jdbc批量插入")
    @PostMapping("/test_jdbc")
    public void testJ (int count) {
        try {
            userService.jdbcBatchInsert(count);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @ApiOperation("jdbc批量修改")
    @PostMapping("/test_jdbc_update")
    public void testUpdate (int count) {
        try {
            userService.jdbcBatchUpdate(count);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
